package Pet;
class Petshop {
	 private Pet[] pets;
	 private int foot;
	 public Petshop(int len){
		 if(len>0){
			 this.pets=new Pet[len];
		 }
		 else{
			 this.pets=new Pet[1];
		 }
	 }
	 public boolean add(Pet pet){
		 if(this.foot<this.pets.length){
			 this.pets[this.foot]=pet;
			 this.foot++;
			 return true;
		 }
		 else{
			 return false;
		 }
	 }
	
	 public void print(Pet p[]){
			for(int i=0;i<p.length;i++){
				if(p[i]!=null){
					System.out.println(p[i].getNo()+","+p[i].getKind()+","+p[i].getColor()+
							","+p[i].getAge()+","+p[i].getPrice());
				}
			}
	 }
		public Pet search(String no){
			Pet p=null;
			for(int i=0;i<this.pets.length;i++){
				if(this.pets[i].getNo().indexOf(no)!=-1){
					p=this.pets[i];	
				}
			}
			return p;
	}
	 public void kind(Pet p){
		 for(int i=0;i<this.pets.length;i++){
			 if(this.pets[i]instanceof Dog){
				 System.out.println("gou");
			 }
			 else if(this.pets[i]instanceof Cat ) {
				System.out.println("mao");
			 }
		 }
	 }
	 
  
}
